package com.wdy.abstractfactory;

/**
 * @ClassName: KingMaker
 * @Description: TODO
 * @Date: 2019/12/30 12:53
 * @Author: wangdy001
 * @Version: 1.0
 */
public class KingMaker {
    private static KingdomFactory makeFactory(KingdomType type) {
        if(KingdomType.ELF.equals(type)) {
            return new ElfKingdomFactory();
        }
        return new OrcKingdomFactory();
    }
    public static void main(String[] args) {
        KingdomFactory kingdomFactory = KingMaker.makeFactory(KingdomType.ELF);
        Army army = kingdomFactory.createArmy();
        System.out.println(army.getDescription());
        Castle castle = kingdomFactory.createCastle();
        System.out.println(castle.getDescription());
    }
}
